import request from '@/utils/request'
import {
  getToken2
} from "@/utils/auth.js"
import axios from 'axios'


export function getStock(pid) {
  return request({
    url: '/stock/get',
    params: {
      'production': pid
    },
    method: 'get'
  })
}
export function listStock(pos, size, conditions) {
  return request({
    url: '/stock/list',
    params: {
      'jsonCondition': JSON.stringify(conditions),
      'pos': pos,
      'size': size
    },
    method: 'get'
  })
}

export function getStock2(prod) {
  let data = {
    "custnumber": sessionStorage.getItem("loginuser"),
    "materialnumber": prod
  };
  let token = getToken2()
  return axios.post("http://157.122.97.186:15000/k3cloud/services/Command.ashx?cmd=GetErpExpectQty&token=" + token, JSON.stringify(data), {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  })
}
